﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProductList.ascx.cs"
    Inherits="HUGATE.Item.Controls.Product.ProductList" %>
<%@ Register Src="~/Controls/ERP/Common/SearchObject.ascx" TagName="SearchObject"
    TagPrefix="uc2" %>
<%@ Register Src="ProductEdit.ascx" TagName="ProductEdit" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/ERP/Item/Category/ParentCategory.ascx" TagName="ParentCategory"
    TagPrefix="uc3" %>
<table border="0" cellpadding="2" cellspacing="0" style="width: 100%">
    <tbody>
        <tr>
            <td>
                <%= HUGATE.Utility.ResxManager.GetString("SearchString") + ":"%>
            </td>
            <td>
                <asp:TextBox ID="txtSearch" runat="server" CssClass="txtSearch"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <%=HUGATE.Utility.ResxManager.GetString("ITEMCategory")%>
            </td>
            <td>
                <asp:UpdatePanel ID="udpCategory" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:TextBox ID="txtCategoryNameS" runat="server" Enabled="false" Width="230px"></asp:TextBox>
                        <asp:Button ID="btnChooseCategory" runat="server" CssClass="Control_ButtonBrowse"
                            Text="..." />
                        <asp:ImageButton ID="ibtClearCategory" runat="Server" ImageUrl="~/App_Themes/Default/Images/Buttons/btnDel.gif"
                            ToolTip="Clear" OnClick="ibtClearCategory_Click" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCategoryNameS"
                            ErrorMessage="*" ValidationGroup="Inputproduct"></asp:RequiredFieldValidator>
                        <asp:Panel ID="pnlInputCategory" runat="server" CssClass="Popup_Table" Style="display: none;
                            width: 300px">
                            <div class="Popup_Title">
                                <table border="0" cellpadding="0" cellspacing="0" class="Popup_Title" style="width: 100%">
                                    <tr>
                                        <td>
                                            <strong>
                                                <%=HUGATE.Utility.ResxManager.GetString("Choose") +" "+ HUGATE.Utility.ResxManager.GetString("SearchString")%></strong>
                                        </td>
                                        <td align="center" style="padding-right: 2px; width: 20px">
                                            <div class="Popup_BtClose" style="width: 16px; height: 17px; text-align: center">
                                                <asp:LinkButton ID="lbtCloseCategory" runat="server" CssClass="Popup_BtClose" Style="height: 17px">&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div style="overflow: scroll; height: 500px;">
                                <div class="Popup_Content">
                                    <uc3:ParentCategory id="ctlParentCategory" runat="server">
                                    </uc3:ParentCategory>
                                </div>
                            </div>
                        </asp:Panel>
                        <ajax:ModalPopupExtender ID="mpeCaragory" runat="server" BackgroundCssClass="ModalPopupBackground"
                            CancelControlID="lbtCloseCategory" PopupControlID="pnlInputCategory" TargetControlID="btnChooseCategory">
                        </ajax:ModalPopupExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                <%=HUGATE.Utility.ResxManager.GetString("ITEMManufacturer")%>
            </td>
            <td>
                <asp:UpdatePanel ID="udpManufacturer" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:TextBox ID="txtManufacturerNameS" runat="server" Enabled="false" Width="230px"></asp:TextBox>
                        <asp:Button ID="btnChooseManufacturer" runat="server" CssClass="Control_ButtonBrowse"
                            Text="..." />
                        <asp:ImageButton ID="ibtClearManufacturer" runat="Server" ImageUrl="~/App_Themes/Default/Images/Buttons/btnDel.gif"
                            ToolTip="Clear" OnClick="ibtClearManufacturer_Click" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtManufacturerNameS"
                            ErrorMessage="*" ValidationGroup="Inputproduct"></asp:RequiredFieldValidator>
                        <asp:Panel ID="pnlInputManufacturer" runat="server" CssClass="Popup_Table" Style="display: none;
                            width: 420px">
                            <div class="Popup_Title">
                                <table border="0" cellpadding="0" cellspacing="0" class="Popup_Title" style="width: 100%">
                                    <tr>
                                        <td>
                                            <strong>
                                                <%=HUGATE.Utility.ResxManager.GetString("Choose") +" "+ HUGATE.Utility.ResxManager.GetString("SearchString")%></strong>
                                        </td>
                                        <td align="center" style="padding-right: 2px; width: 20px">
                                            <div class="Popup_BtClose" style="width: 16px; height: 17px; text-align: center">
                                                <asp:LinkButton ID="lbtManufacturer" runat="server" CssClass="Popup_BtClose" Style="height: 17px">&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="Popup_Content">
                                <uc2:SearchObject id="SOManufacturer" runat="server">
                                </uc2:SearchObject>
                            </div>
                        </asp:Panel>
                        <ajax:ModalPopupExtender ID="mpeManufacturer" runat="server" BackgroundCssClass="ModalPopupBackground"
                            CancelControlID="lbtManufacturer" PopupControlID="pnlInputManufacturer" TargetControlID="btnChooseManufacturer">
                        </ajax:ModalPopupExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>
                <%=HUGATE.Utility.ResxManager.GetString("ITEMUnit")%>
            </td>
            <td>
                <asp:UpdatePanel ID="udpUnit" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:TextBox ID="txtUnitNameS" runat="server" Enabled="false" Width="230px"></asp:TextBox>
                        <asp:Button ID="btnChooseUnit" runat="server" CssClass="Control_ButtonBrowse" Text="..." />
                        <asp:ImageButton ID="ibtClearUnit" runat="Server" ImageUrl="~/App_Themes/Default/Images/Buttons/btnDel.gif"
                            ToolTip="Clear" OnClick="ibtClearUnit_Click" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtUnitNameS"
                            ErrorMessage="*" ValidationGroup="Inputproduct"></asp:RequiredFieldValidator>
                        <asp:Panel ID="pnlInputUnit" runat="server" CssClass="Popup_Table" Style="display: none;
                            width: 420px">
                            <div class="Popup_Title">
                                <table border="0" cellpadding="0" cellspacing="0" class="Popup_Title" style="width: 100%">
                                    <tr>
                                        <td>
                                            <strong>
                                                <%=HUGATE.Utility.ResxManager.GetString("Choose") +" "+ HUGATE.Utility.ResxManager.GetString("SearchString")%></strong>
                                        </td>
                                        <td align="center" style="padding-right: 2px; width: 20px">
                                            <div class="Popup_BtClose" style="width: 16px; height: 17px; text-align: center">
                                                <asp:LinkButton ID="lbtUnit" runat="server" CssClass="Popup_BtClose" Style="height: 17px">&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="Popup_Content">
                                <uc2:SearchObject id="SOUnit" runat="server">
                                </uc2:SearchObject>
                        </asp:Panel>
                        <ajax:ModalPopupExtender ID="mpeUnit" runat="server" BackgroundCssClass="ModalPopupBackground"
                            CancelControlID="lbtUnit" PopupControlID="pnlInputUnit" TargetControlID="btnChooseUnit">
                        </ajax:ModalPopupExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                <%=HUGATE.Utility.ResxManager.GetString("ITEMProductStatus")%>
            </td>
            <td>
                <asp:UpdatePanel ID="udpProductStatus" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:TextBox ID="txtProductStatusNameS" runat="server" Enabled="false" Width="230px"></asp:TextBox>
                        <asp:Button ID="btnChoseProductStatus" runat="server" CssClass="Control_ButtonBrowse"
                            Text="..." />
                        <asp:ImageButton ID="ibtClearProductStatus" runat="Server" ImageUrl="~/App_Themes/Default/Images/Buttons/btnDel.gif"
                            ToolTip="Clear" OnClick="ibtClearProductStatus_Click" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtProductStatusNameS"
                            ErrorMessage="*" ValidationGroup="Inputproduct"></asp:RequiredFieldValidator>
                        <asp:Panel ID="pnlProductStatus" runat="server" CssClass="Popup_Table" Style="display: none;
                            width: 420px">
                            <div class="Popup_Title">
                                <table border="0" cellpadding="0" cellspacing="0" class="Popup_Title" style="width: 100%">
                                    <tr>
                                        <td>
                                            <strong>
                                                <%=HUGATE.Utility.ResxManager.GetString("Choose") +" "+ HUGATE.Utility.ResxManager.GetString("SearchString")%></strong>
                                        </td>
                                        <td align="center" style="padding-right: 2px; width: 20px">
                                            <div class="Popup_BtClose" style="width: 16px; height: 17px; text-align: center">
                                                <asp:LinkButton ID="lbtProductStatus" runat="server" CssClass="Popup_BtClose" Style="height: 17px">&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="Popup_Content">
                                <uc2:SearchObject id="SOProductStatus" runat="server">
                                </uc2:SearchObject>
                        </asp:Panel>
                        <ajax:ModalPopupExtender ID="mpeProductStatus" runat="server" BackgroundCssClass="ModalPopupBackground"
                            CancelControlID="lbtProductStatus" PopupControlID="pnlProductStatus" TargetControlID="btnChoseProductStatus">
                        </ajax:ModalPopupExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td colspan="6" style="height: 26px">
                <asp:Button ID="btnSearch" runat="server" CssClass="Control_Button1" Text="Tìm kiếm"
                    OnClick="btnSearch_Click1" />
                <asp:Button ID="btnAddNew" runat="server" CssClass="Control_Button1" Text="Nhập mới"
                    OnClick="btnAddNew_Click" />
                <asp:Button ID="btnReturn" runat="server" CssClass="Control_Button1" Text="Trở về"
                    UseSubmitBehavior="False" />
            </td>
        </tr>
    </tbody>
</table>
<asp:UpdatePanel ID="udpList" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:GridView ID="grvObject" CssClass="Gridview" runat="server" Width="100%" PageSize="20"
            DataKeyNames="ProductID" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="grvObject_PageIndexChanging1">
            <RowStyle CssClass="Row"></RowStyle>
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtproduct" runat="Server" Text='<%#Eval("ProductID") %>' OnClick="lbtproduct_Click">
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="ProductName">
                    <ItemStyle Width="200px"></ItemStyle>
                </asp:BoundField>
                <asp:BoundField DataField="CategoryName"></asp:BoundField>
                <asp:BoundField DataField="ManufacturerName"></asp:BoundField>
                <asp:BoundField DataField="UnitName"></asp:BoundField>
                <asp:BoundField DataField="ProductStatusName"></asp:BoundField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label runat="Server" ID="lblvat" Text='<%#Convert.ToDouble("0"+Eval("VAT")).ToString("#,##0")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="VATPercent"></asp:BoundField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <%#Eval("Description").ToString().Replace("\n","<BR />" )%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="IsSerial"></asp:CheckBoxField>
                <asp:CheckBoxField DataField="IsActived">
                    <ItemStyle HorizontalAlign="Center" Width="70px"></ItemStyle>
                </asp:CheckBoxField>
                <asp:TemplateField>
                    <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                        <%# GetProductImage(Container.DataItem) %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle CssClass="Delete" />
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtDelete" runat="server" CommandArgument='<%#Eval("ProductID")%>'
                            CssClass="DeleteBtn" OnClick="imgDelete_Click" OnClientClick='<%# "return confirm(\"" + string.Format(HUGATE.Utility.ResxManager.GetString("DeleteConfirm"), "") + "\");" %>'
                            ToolTip='<%#HUGATE.Utility.ResxManager.GetString("Delete")%>'>
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <center>
                    <%#HUGATE.Utility.ResxManager.GetString("BUTEmptyData")%>
                </center>
            </EmptyDataTemplate>
            <HeaderStyle CssClass="Header"></HeaderStyle>
            <AlternatingRowStyle CssClass="RowAlt"></AlternatingRowStyle>
        </asp:GridView>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
